Working through these tutorials in order is the best way to learn to build GUI's with AWNPipe. A few minutes here will save you hours of development time later.
TUTORIAL 1
-----------
Building GUIs ca be VERY easy, This first tutorial will develop a simple GUI.
Create a simple 4 line text file called first.gui . (you can dragselect and the Right Amiga C to copy text from these docs)
title "My first GUI" defaultgadgets
button gadgettext "YES"
button gt "NO"
open
Now in a shell 'copy first.gui awnpipe:/xc'.
That was easy. You already guessed that gt was a short form for gadgettext.
Now we want to see what events the GUI sends. We can direct the events to a con by adding 'wcon:' to the end of the pipe name. Try
'copy first.gui awnpipe:/xcwcon:'
Notice that the pipe replies to each line of the definition file as well as sending events.
Now add a little text to the gui. We will also provide keyboard shortcuts for the gadgets.
title "My first GUI" defaultgadgets
label gt " Select YES or NO "
button gadgettext "_YES"
button gadgettext "_NO"
open
That worked, but it looks a little UGLY. Lets try a vertical layout instead of horizontal (the default).
title "My first GUI" defaultgadgets vertical
label gt " Select YES or NO "
button gadgettext "_YES"
button gadgettext "_NO"
open
Getting better but we really want the two gadgets side by side. To do that we will use a layout group. (le is layout end).
title "My first GUI" defaultgadgets vertical
label gt " Select YES or NO "
layout
button gadgettext "_YES"
button gadgettext "_NO"
le
open
That is much better! Looks good but it would be nicer if the window closed after the user selected yes or no. ( you also notice that the layout received a GID number so yes and no are now gadget 2 and 3)
title "My first GUI" defaultgadgets vertical
label gt " Select YES or NO "
layout
button gadgettext "_YES" close
button gadgettext "_NO" c
le
open
Its done, it might even be useful.
Since we have a working gui lets use it to see a few other types of events the GUI can generate.
title "My first GUI" defaultgadgets vertical sendkeys sendqual help state
label gt " Select YES or NO "
layout
button gadgettext "_YES" close
button gadgettext "_NO" c
le
open
Activate and inactivate the window. Hold the mouse over each gadget. Type a few keys. Try the shift, alt ect.